#define _CRT_SECURE_NO_WARNINGS 1
//#include <iostream>
//
//using namespace std;
//typedef long long ll;
//
//ll Col(ll x, ll y, ll z)
//{
//    if (y % 2 == 0)
//    {
//        return x % z;
//    }
//
//    return z - (x % z) + 1;
//}
//
//ll Row(ll x, ll y)
//{
//    ll temp = (x - 1) / y;
//    return temp;
//}
//
//int main()
//{
//    ll w = 0;
//    ll m = 0;
//    ll n = 0;
//    cin >> w >> m >> n;
//    ll row_m, row_n;
//    ll col_m, col_n;
//    row_n = Row(n, w);
//    row_m = Row(m, w);
//    col_n = Col(n, row_n, w);
//    col_m = Col(m, row_m, w);
//    cout << abs(row_n - row_m) + abs(col_n - col_m);
//
//    return 0;
//}

# include <iostream>

using namespace std;

int main()
{
    int num = 0;
    cin >> num;
    int rest = 0;
    int sum = num;
    while (num >= 3)
    {
        sum += num / 3;
        rest = num % 3 + num / 3;
        num = rest;
    }
    cout << sum << endl;
    return 0;
}